\newcommand{\TODO}[1]{%
\typeout{WARNING!!! there is still a TODO left}
\marginpar{\textbf{!TODO: }\emph{#1}}
}

\def\alpvec{[\vec{\alpha}]}
\def\alpprevec{\vec{\alpha}}
\def\betvec{[\vec{\beta}_j]}
\def\betprevec{\vec{\beta}_j}

\def\blackmu{\mu_{\smallblackdot}} 
\def\graymu {\mu_{\smallgraydot}}
\def\whitemu{\mu_{\smallwhitedot}}

\def\blacketa{\eta_{\smallblackdot}} 
\def\grayeta {\eta_{\smallgraydot}}
\def\whiteeta{\eta_{\smallwhitedot}}

\def\blackdelta{\delta_{\smallblackdot}} 
\def\graydelta {\delta_{\smallgraydot}}
\def\whitedelta{\delta_{\smallwhitedot}}

\def\blackepsilon{\epsilon_{\smallblackdot}} 
\def\grayepsilon {\epsilon_{\smallgraydot}}
\def\whiteepsilon{\epsilon_{\smallwhitedot}}

% \def\whiteeta{\eta_{\!\smallwhitedot}}
% \def\whitevarepsilon{\varepsilon_{\!\smallwhitedot}}

\def\whitePhi{\Phi_{\!\smallwhitedot}}
\def\graymeas{m_{\!\smallgraydot}}

\newcommand{\Owg}{\ensuremath{{\cal O}_{\!\smallwhitedot\!,\!\smallgraydot}}}
\newcommand{\whiteK}{\ensuremath{{\cal  K}_{\!\smallwhitedot}}}
\newcommand{\grayK}{\ensuremath{{\cal  K}_{\!\smallgraydot}}}


% BRAS AND KETS
\newcommand{\bra}[1]{\ensuremath{\left\langle #1 \right|}}
\newcommand{\ket}[1]{\ensuremath{\left|  #1 \right\rangle}}
\newcommand{\roundket}[1]{\ensuremath{\left|  #1 \right)}}
\newcommand{\braket}[2]{\ensuremath{\langle#1|#2\rangle}}
\newcommand{\ketbra}[2]{\ensuremath{\ket{#1}\!\bra{#2}}}

\newcommand{\innp}[2]{\braket{#1}{#2}}
\newcommand{\outp}[2]{\ketbra{#1}{#2}}

\newcommand{\ketGHZ} {\ket{\textit{GHZ}\,}}
\newcommand{\ketW}   {\ket{\textit{W\,}}}
\newcommand{\ketBell}{\ket{\textit{Bell\,}}}
\newcommand{\ketEPR} {\ket{\textit{EPR\,}}}
\newcommand{\ketGHZD}{\ket{\textrm{GHZ}^{(D)}}}
\newcommand{\ketWD}  {\ket{\textrm{W}^{(D)}}}

\newcommand{\braGHZ} {\bra{\textit{GHZ}\,}}
\newcommand{\braW}   {\bra{\textit{W\,}}}
\newcommand{\braBell}{\bra{\textit{Bell\,}}}
\newcommand{\braEPR} {\bra{\textit{EPR\,}}}

\newcommand{\CX}{\wedge X}
\newcommand{\CZ}{\wedge Z}

%%%% useful cats notation
\newcommand{\id}[1]{\ensuremath{1_{#1}}}

\newcommand{\rw}{\Rightarrow}
\newcommand{\RW}[1]{\stackrel{#1}{\Rightarrow}}
\newcommand{\EQ}[1]{\stackrel{#1}{=}}

\newcommand{\denote}[1]{% --``semantic'' brakets
\llbracket #1 \rrbracket} 



%%%%% nicely fornatted names for categories

\newcommand{\catname}[1]{\ensuremath{\mathbf{#1}}\xspace}
\newcommand{\catnamesub}[2]{\ensuremath{\mathbf{#1}_{#2}}\xspace}
\newcommand{\catnamesup}[2]{\ensuremath{\mathbf{#1}^{#2}}\xspace}


\newcommand{\spek}{\catname{Spek}}
\newcommand{\stab}{\catname{Stab}}
\newcommand{\qubit}{\catname{Qubit}}
\newcommand{\fhilb}{\catname{FHilb}}
\newcommand{\fhilbd}{\catnamesub{FHilb}{D}}
\newcommand{\fhilbii}{\catnamesub{FHilb}{2}}
\newcommand{\fdhilb}{\fhilb}
\newcommand{\fdhilbd}{\fhilbd}
\newcommand{\fdhilbii}{\fhilbii}
\newcommand{\frel}{\catname{FRel}}
\newcommand{\FRel}{\frel}
\newcommand{\Frel}{\frel}
\newcommand{\freld}{\catnamesub{FRel}{D}}
\newcommand{\Freld}{\freld}
\newcommand{\FRelD}{\freld}
\newcommand{\frelii}{\catnamesub{FRel}{2}}
\newcommand{\Frelii}{\frelii}
\newcommand{\FRelii}{\frelii}
\newcommand{\fset}{\catname{FSet}}
\newcommand{\perm}{\catname{Perm}}
\newcommand{\stoch}{\catname{Stoch}}
\newcommand{\bool}{\catname{Bool}}
\newcommand{\symgrp}{\catname{SymGrp}}

\newcommand{\boolcircs}{\catname{BoolCirc}}
\newcommand{\boolcirc}{\boolcircs}
\newcommand{\qcircs}{\catname{QuCirc}}
\newcommand{\qcirc}{\qcircs}

\newcommand{\CC}{\catname{C}}
\newcommand{\CCop}{\catnamesup{C}{\mathrm{op}}}
\newcommand{\DD}{\catname{D}}
\newcommand{\DDop}{\catnamesup{D}{\mathrm{op}}}

% CATEGORY VARIABLES
\newcommand{\catC}{\CC}   %{\ensuremath{\mathcal{C}}\xspace}
\newcommand{\catCop}{\CCop}   %{\ensuremath{\mathcal{C}^{\mathrm{op}}}\xspace}
\newcommand{\catD}{\DD}    %{\ensuremath{\mathcal{D}}\xspace}
\newcommand{\catDop}{\DDop}   %{\ensuremath{\mathcal{D}^{\mathrm{op}}}\xspace}


% STANDARD CATEGORIES
% \newcommand{\catSet}{\ensuremath{\textrm{\bf Set}}\xspace}
% \newcommand{\catRel}{\ensuremath{\textrm{\bf Rel}}\xspace}
\newcommand{\catFRel}{\frel}  % {\ensuremath{\textrm{\bf FRel}}\xspace}
% \newcommand{\catVect}{\ensuremath{\textrm{\bf Vect}}\xspace}
% \newcommand{\catFVect}{\ensuremath{\textrm{\bf FVect}}\xspace}
\newcommand{\catFHilb}{\fhilb}  %  {\ensuremath{\textrm{\bf FHilb}}\xspace}
% \newcommand{\catHilb}{\ensuremath{\textrm{\bf Hilb}}\xspace}
% \newcommand{\catSuperHilb}{\ensuremath{\textrm{\bf SuperHilb}}\xspace}
% \newcommand{\catAb}{\ensuremath{\textrm{\bf Ab}}\xspace}
% \newcommand{\catTop}{\ensuremath{\textrm{\bf Top}}\xspace}
% \newcommand{\catCHaus}{\ensuremath{\textrm{\bf CHaus}}\xspace}
% \newcommand{\catHaus}{\ensuremath{\textrm{\bf Haus}}\xspace}
% \newcommand{\catGraph}{\ensuremath{\textrm{\bf Graph}}\xspace}
% \newcommand{\catMat}{\ensuremath{\textrm{\bf Mat}}\xspace}
% \newcommand{\catGr}{\ensuremath{\textrm{\bf Gr}}\xspace}
\newcommand{\catSpek}{\spek}  %{\ensuremath{\textrm{\bf Spek}}\xspace}

\DeclareMathOperator{\CP}{CP}

%%%%%%%%%% Stolen from Aleks's Quantum Computation notes

\newcommand{\boxmap}[1]{\,\tikz[dotpic]{\node[style=square box] (x) {$#1$};\draw(0,-1)--(x)--(0,1);}\,}

\newcommand{\map}[1]{\,\tikz[dotpic]{\node[style=map] (x) {$#1$};\draw(0,-1.3)--(x)--(0,1.3);}\,}

\newcommand{\mapdag}[1]{\,\tikz[dotpic]{\node[style=mapdag] (x) {$#1$};\draw(0,-1.3)--(x)--(0,1.3);}\,}

\newcommand{\pointmap}[1]{\,\tikz[dotpic]{\node[style=point] (x) at (0,-0.5) {$#1$};\draw (x)--(0,1);}\,}

\newcommand{\copointmap}[1]{\,\tikz[dotpic]{\node[style=copoint] (x) at (0,0.5) {$#1$};\draw (x)--(0,-1);}\,}

\newcommand{\graypointmap}[1]{\,\tikz[dotpic]{\node[style=gray point] (x) at (0,-0.5) {$#1$};\draw (x)--(0,1);}\,}



% ========================
% = COMMUTATIVE DIAGRAMS =
% ========================

\tikzstyle{cdiag}=[matrix of math nodes, row sep=3em, column sep=3em, text height=1.5ex, text depth=0.25ex,inner sep=0.5em]
\tikzstyle{arrow above}=[transform canvas={yshift=0.5ex}]
\tikzstyle{arrow below}=[transform canvas={yshift=-0.5ex}]

\newcommand{\csquare}[8]{
\begin{tikzpicture}
    \matrix(m)[cdiag,ampersand replacement=\&]{
    #1 \& #2 \\
    #3 \& #4  \\};
    \path [arrs] (m-1-1) edge node {$#5$} (m-1-2)
                 (m-2-1) edge node {$#6$} (m-2-2)
                 (m-1-1) edge node [swap] {$#7$} (m-2-1)
                 (m-1-2) edge node {$#8$} (m-2-2);
\end{tikzpicture}
}

% commands for putting pushout/pullback brackets on commutative diags
\newcommand{\NWbracket}[1]{%
\draw #1 +(-0.25,0.5) -- +(-0.5,0.5) -- +(-0.5,0.25);}
\newcommand{\NEbracket}[1]{%
\draw #1 +(0.25,0.5) -- +(0.5,0.5) -- +(0.5,0.25);}
\newcommand{\SWbracket}[1]{%
\draw #1 +(-0.25,-0.5) -- +(-0.5,-0.5) -- +(-0.5,-0.25);}
\newcommand{\SEbracket}[1]{%
\draw #1 +(0.25,-0.5) -- +(0.5,-0.5) -- +(0.5,-0.25);}
\newcommand{\THETAbracket}[2]{%
\draw [rotate=#1] #2 +(0.25,0.5) -- +(0.5,0.5) -- +(0.5,0.25);}

\newcommand{\posquare}[8]{
\begin{tikzpicture}
    \matrix(m)[cdiag,ampersand replacement=\&]{
    #1 \& #2 \\
    #3 \& #4  \\};
    \path [arrs] (m-1-1) edge node {$#5$} (m-1-2)
                 (m-2-1) edge node [swap] {$#6$} (m-2-2)
                 (m-1-1) edge node [swap] {$#7$} (m-2-1)
                 (m-1-2) edge node {$#8$} (m-2-2);
    \NWbracket{(m-2-2)}
\end{tikzpicture}
}

\newcommand{\pbsquare}[8]{
\begin{tikzpicture}
    \matrix(m)[cdiag,ampersand replacement=\&]{
    #1 \& #2 \\
    #3 \& #4  \\};
    \path [arrs] (m-1-1) edge node {$#5$} (m-1-2)
                 (m-2-1) edge node [swap] {$#6$} (m-2-2)
                 (m-1-1) edge node [swap] {$#7$} (m-2-1)
                 (m-1-2) edge node {$#8$} (m-2-2);
  \SEbracket{(m-1-1)}
\end{tikzpicture}
}

\newcommand{\ctri}[6]{
    \begin{tikzpicture}[-latex]
        \matrix (m) [cdiag,ampersand replacement=\&] { #1 \& #2 \\ #3 \& \\ };
        \path [arrs] (m-1-1) edge node {$#4$} (m-1-2)
              (m-1-1) edge node [swap] {$#5$} (m-2-1)
              (m-2-1) edge node [swap] {$#6$} (m-1-2);
    \end{tikzpicture}
}

\newcommand{\crun}[5]{
\ensuremath{#1 \overset{#2}{\longrightarrow} #3 \overset{#4}{\longrightarrow} #5}
}

\newcommand{\cspan}[5]{
\ensuremath{#1 \overset{#2}{\longleftarrow} #3
               \overset{#4}{\longrightarrow} #5}
}

\newcommand{\ccospan}[5]{
\ensuremath{#1 \overset{#2}{\longrightarrow} #3
               \overset{#4}{\longleftarrow} #5}
}

\newcommand{\cpair}[4]{
\begin{tikzpicture}
    \matrix(m)[cdiag,ampersand replacement=\&]{
    #1 \& #2 \\};
    \path [arrs] (m-1-1.20) edge node {$#3$} (m-1-2.160)
                 (m-1-1.-20) edge node [swap] {$#4$} (m-1-2.-160);
\end{tikzpicture}
}

\newcommand{\csquareslant}[9]{
\begin{tikzpicture}[-latex]
    \matrix(m)[cdiag,ampersand replacement=\&]{
    #1 \& #2 \\
    #3 \& #4  \\};
    \path [arrs] (m-1-1) edge node {$#5$} (m-1-2)
                 (m-2-1) edge node {$#6$} (m-2-2)
                 (m-1-1) edge node [swap] {$#7$} (m-2-1)
                 (m-1-2) edge node {$#8$} (m-2-2)
                 (m-1-2) edge node [swap] {$#9$} (m-2-1);
\end{tikzpicture}
}


\newcommand{\zxcalculus}{\textsc{zx}-calculus\xspace}
\newcommand{\iso}{\ensuremath{\cong}}
